﻿using PBDesk.Framework.LogNExpMgmt.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace LoggingAndExceptionManagement.Tests
{
    
    
    /// <summary>
    ///This is a test class for LogHelperTest and is intended
    ///to contain all LogHelperTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LogHelperTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for FormatException
        ///</summary>
        [TestMethod()]
        public void FormatExceptionTest()
        {
            string message = string.Empty; // TODO: Initialize to an appropriate value
            Exception ex = null; // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            actual = LogHelper.FormatException(message, ex);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for FormatException
        ///</summary>
        [TestMethod()]
        public void FormatExceptionTest1()
        {
            Exception ex = null; // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;

            //Case-01
            int i = 10, j = 0, k = 0;
            try
            {
                k = i / j;
            }
            catch (Exception ex1)
            {
                Exception ex2 = new ArgumentNullException("argument null message", ex1);
                Exception ex3 = new NullReferenceException("null reference message", ex2);
                actual = LogHelper.FormatException(ex3);
            }
           // ex = new DivideByZeroException();
            actual = LogHelper.FormatException(ex);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
